@extends("h5.layouts.main")
@section('content')
    <?php

    use App\Models\Admin\OrderTempModel;
    use App\admin\Service\OA;
    use App\Models\Admin\OrderBaleModel;
    use App\Models\User\UserModel;
    use App\Jobs\Fun;
    use App\Models\CompanysModel;
    $bale=$_GET['bale']??'';
    $baleModel= OrderBaleModel::where([
        'id'=>$bale,
        'uid'=> OA::$user->getId()
    ])->first();
    if(!$baleModel){
        Fun::showmsg("订单错误");
    }
    
    $list= OrderTempModel::where([
        'bale'=>$bale,
        'cid'=> OA::$user->getId()
    ])
        ->where('status','!=',OrderTempModel::status_weizhifu)
        ->orderBy('id','DESC')->limit(100)->get();
     
    ?>
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/app.css">
    <link rel="stylesheet" type="text/css" href="../css/orderGrad.css">
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>

    <!-- 我的订单（抢单和订单） -->
    <div class="orderDockingPage">
        <div class="orderParamTitle">
            订单对接
            <a onclick="MC.back()"> <img src="../images/return.png" class="orderRtns" ></a>
        </div>
        <div style="height:1.066667rem"></div>
        <div class="content">
            <ul class="list myOrderList">
                <?php foreach ($list as $vo) {
                    $cUser= UserModel::getinfo($vo['fid']);
                    $com_name=CompanysModel::where('uid',$vo['fid'])->value('com_name');
                    ?>
                <li class="detail">
                    <span class="detail__span" 
                          style=background-image:url(<?= $cUser['head'] ?>) alt=""></span>                   
                    <ul>
                        <li>
                            <span>抢单用户名：</span>
                            <span><?= $cUser['name']   ?></span>
                            <?php if($vo['status']== OrderTempModel::status_wancheng){ ?>
                          <a class="button kongzhitai" href="/h5/order/kongzhitai.html?out_trade_no=<?= $vo['out_trade_no'] ?>">控制台</a> 
                            <?php }else { ?>
                            <span><?= OrderTempModel::getstatus($vo['status']) ?></span>
                            <?php } ?>
                        </li>
                        <li  out_trade_no="<?= $vo['out_trade_no']  ?>">
                            <span>工厂名称：</span>
                            <span><?= $com_name  ?></span>
                          <?php if($baleModel->status!== OrderBaleModel::status_wancheng){ ?>
                            <a class="button xuanzehezuo">选中合作</a> <?php
                          }else{
                              echo '<span></span>';
                          }
                          ?>
                        </li>
                        <li>
                            <span>抢单时间：</span>
                            <span class="timedate"><?= Fun::date($vo['created_at'],false) ?></span>

                            <a class="button jiaoliu" call="<?= $cUser['id']  ?>">商务交流</a>
                        </li>
                     <?php /*   <li>
                            <span>信用等级：</span>
                            <span class="timedate"><?php
                                $level=\App\Models\User\UserLevelModel::getUserLevel($vo['fid']);
                                if($level){
                                   echo $level['info']['name'];
                                }
                               // var_dump($level);exit;
                                ?></span>


                        </li> */ ?>

                       
                    </ul>
                </li>
                <?php } ?>
                
            </ul>
        </div>
    </div>
 
    <script>
    new  MC.Order.orderXuanze();
    
    </script>


@stop